let ipts = document.querySelectorAll('input')
// console.log(ipts);
//请求接口，进行登陆
ipts[2].onclick = function() {
    let username = ipts[0].value
    let password = ipts[1].value
    let params = {
        username,
        password,
    };
    axios.get(logAPI, { params }).then(res => {
        console.log(res);
        alert(res.data.msg)
        if (res.data.code == 1) {
            let uid = res.data.data.id
            console.log(uid);
            localStorage.setItem('uid', uid)
            localStorage.setItem('token', res.data.data.token)
            localStorage.setItem('username', res.data.data.username)
            location.href = 'index.html'
        }
    })
};

//扫码和登陆切换
let zhdl = document.querySelector('#zhdl')
let cmdl = document.querySelector('#cmdl')
let mainb = document.querySelector('.main-r-b')
let mainl = document.querySelector('.main-r-l')
// console.log(cmdl);
// console.log(mainb);
cmdl.onclick=function(e){
    e.preventDefault();
    cmdl.style.color= "#f56600"
    zhdl.style.color= "#666"
    mainb.style.display = "none"
    mainl.style.display = "block"
    // e.stopPropagation();阻止事件冒泡
}
zhdl.onclick=function(e){
    e.preventDefault();
    cmdl.style.color= "#666"
    zhdl.style.color= "#f56600"
    mainb.style.display = "block"
    mainl.style.display = "none"
    // e.stopPropagation();阻止事件冒泡
}